namespace AceMobile.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class osidvaproducerid : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.Phones", "PhoneOS_ID", "dbo.PhoneOS");
            DropForeignKey("dbo.Phones", "PhoneProducer_ID", "dbo.PhoneProducers");
            DropIndex("dbo.Phones", new[] { "PhoneOS_ID" });
            DropIndex("dbo.Phones", new[] { "PhoneProducer_ID" });
            RenameColumn(table: "dbo.Phones", name: "PhoneOS_ID", newName: "PhoneOSID");
            RenameColumn(table: "dbo.Phones", name: "PhoneProducer_ID", newName: "PhoneProducerID");
            AddForeignKey("dbo.Phones", "PhoneOSID", "dbo.PhoneOS", "ID", cascadeDelete: true);
            AddForeignKey("dbo.Phones", "PhoneProducerID", "dbo.PhoneProducers", "ID", cascadeDelete: true);
            CreateIndex("dbo.Phones", "PhoneOSID");
            CreateIndex("dbo.Phones", "PhoneProducerID");
        }
        
        public override void Down()
        {
            DropIndex("dbo.Phones", new[] { "PhoneProducerID" });
            DropIndex("dbo.Phones", new[] { "PhoneOSID" });
            DropForeignKey("dbo.Phones", "PhoneProducerID", "dbo.PhoneProducers");
            DropForeignKey("dbo.Phones", "PhoneOSID", "dbo.PhoneOS");
            RenameColumn(table: "dbo.Phones", name: "PhoneProducerID", newName: "PhoneProducer_ID");
            RenameColumn(table: "dbo.Phones", name: "PhoneOSID", newName: "PhoneOS_ID");
            CreateIndex("dbo.Phones", "PhoneProducer_ID");
            CreateIndex("dbo.Phones", "PhoneOS_ID");
            AddForeignKey("dbo.Phones", "PhoneProducer_ID", "dbo.PhoneProducers", "ID");
            AddForeignKey("dbo.Phones", "PhoneOS_ID", "dbo.PhoneOS", "ID");
        }
    }
}
